#include "CollisionManager.h"


CollisionManager::CollisionManager(void)
{
}

CollisionManager::~CollisionManager(void)
{
}

void CollisionManager::DetectCollision(list<Object*> objectList)
{
	list<Object*>::iterator iter_obj = objectList.begin();
	list<Object*>::iterator iter_cur;
	for (; iter_obj != objectList.end(); iter_obj++)
	{
		// TODO : skip Plane
		if ((*iter_obj)->GetType() == PLANE)
		{
			continue;
		}
		iter_cur = iter_obj;
		iter_cur++;
		
		for (; iter_cur != objectList.end(); iter_cur++)
		{
			// TODO: skip Plane
			if ((*iter_cur)->GetType() == PLANE)
			{
				continue;
			}
			
			bool isCollid = (*iter_obj)->IsCollideWithObject(*iter_cur);
			if (isCollid)
			{
				printf("object collision detected \n");
			}

		}

		/// detect collid with edge of screen
		if ((*iter_obj)->IsCollideEdge())
		{
			printf("edge collision detected \n");
		}
	}
}
